﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="BlackHorizontalListBox" TargetType="{x:Type ListBox}">
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Foreground" Value="White"/>
        <!-- Set the ItemTemplate of the ListBox to a DataTemplate 
           which explains how to display an object of type BitmapImage. -->
        <Setter Property="ItemTemplate">
            <Setter.Value>
                <DataTemplate>
                    <Border 
              BorderBrush="Black" 
              BorderThickness="4" 
              CornerRadius="5"
              Margin="6"
              >
                        <Image 
                Source="{Binding Path=UriSource}" 
                Stretch="Fill"
                Width="100" Height="120" 
               />
                    </Border>
                </DataTemplate>
            </Setter.Value>
        </Setter>

        <!-- Swap out the default items panel with a WrapPanel so that
           the images will be arranged with a different layout. -->
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <WrapPanel />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

        <!-- Set this attached property to 'Disabled' so that the 
           ScrollViewer in the ListBox will never show a horizontal 
           scrollbar, and the WrapPanel it contains will be constrained 
           to the width of the ScrollViewer's viewable surface. -->
        <Setter 
        Property="ScrollViewer.HorizontalScrollBarVisibility" 
        Value="Disabled" 
        />
        <Style.Resources>
            <!-- Background of selected item when focussed -->

            <LinearGradientBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" EndPoint="0.504,1.5" StartPoint="0.504,0.03">
                <GradientStop Color="#d8d5e2" Offset="0"/>
                <GradientStop Color="Transparent" Offset="0.567"/>
            </LinearGradientBrush>
            <!-- Background of selected item when not focussed -->

            <LinearGradientBrush  x:Key="{x:Static SystemColors.ControlBrushKey}" EndPoint="0.504,1.5" StartPoint="0.504,0.03">
                <GradientStop Color="#d8d5e2" Offset="0"/>
                <GradientStop Color="Transparent" Offset="0.567"/>
            </LinearGradientBrush>
        </Style.Resources>
    </Style>
    <DataTemplate x:Key="ItemTemplate">
        <StackPanel Margin="0,0,0,5" >


            <TextBlock Text="{Binding TrackTitle}" TextWrapping="Wrap" Foreground="White" />

        </StackPanel>
    </DataTemplate>

    <DataTemplate x:Key="SelectedTemplate">

        <StackPanel Margin="0,0,0,5" Orientation="Horizontal" Width="Auto"  >

            <Image Source="/MP3Tunes.WPF;component/Images/light/appbar.transport.play.rest.png" Width="24" Height="24" VerticalAlignment="Center"/>
            <TextBlock Text="{Binding TrackTitle}" TextWrapping="Wrap"  VerticalAlignment="Center" Foreground="Blue"/>

        </StackPanel>



    </DataTemplate>

    <Style TargetType="{x:Type ListBoxItem}" x:Key="ContainerStyle">
        <Setter Property="ContentTemplate" Value="{StaticResource ItemTemplate}" />
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="ContentTemplate" Value="{StaticResource SelectedTemplate}" />
                <Setter Property="Background" Value="{StaticResource SelectedItemBackground}" />

            </Trigger>
        </Style.Triggers>
        <Style.Resources>
            <!-- Background of selected item when focussed -->
            <DrawingBrush x:Key="{x:Static SystemColors.ControlBrushKey}">
                <DrawingBrush.Drawing>

                    <GeometryDrawing>

                        <GeometryDrawing.Brush>
                            <LinearGradientBrush  EndPoint="0.504,1.5" StartPoint="0.504,0.03">
                                <GradientStop Color="#d8d5e2" Offset="0"/>
                                <GradientStop Color="Transparent" Offset="0.567"/>
                            </LinearGradientBrush>
                        </GeometryDrawing.Brush>
                        <!--<GeometryDrawing.Pen >
                                <Pen Brush="White" Thickness="1" ></Pen>
                            </GeometryDrawing.Pen>-->

                        <GeometryDrawing.Geometry>
                            <RectangleGeometry Rect="0,0,50,50" RadiusX="1" RadiusY="1"  >

                            </RectangleGeometry>

                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                </DrawingBrush.Drawing>
            </DrawingBrush>
            <DrawingBrush x:Key="{x:Static SystemColors.HighlightBrushKey}">
                <DrawingBrush.Drawing>

                    <GeometryDrawing>

                        <GeometryDrawing.Brush>
                            <LinearGradientBrush  EndPoint="0.504,1.5" StartPoint="0.504,0.03">
                                <GradientStop Color="#d8d5e2" Offset="0"/>
                                <GradientStop Color="Transparent" Offset="0.567"/>
                            </LinearGradientBrush>
                        </GeometryDrawing.Brush>
                        <!--<GeometryDrawing.Pen >
                                <Pen Brush="White" Thickness="1" ></Pen>
                            </GeometryDrawing.Pen>-->

                        <GeometryDrawing.Geometry>
                            <RectangleGeometry Rect="0,0,50,50" RadiusX="1" RadiusY="1"  >

                            </RectangleGeometry>

                        </GeometryDrawing.Geometry>
                    </GeometryDrawing>
                </DrawingBrush.Drawing>
            </DrawingBrush>
        </Style.Resources>
    </Style>

</ResourceDictionary>